package zookeeper.java_api.demo;

import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.server.auth.DigestAuthenticationProvider;

import java.io.IOException;

public class AclUtils {
	
	public static String getDigestUserPwd(String id) throws Exception {
		return DigestAuthenticationProvider.generateDigest(id);
	}
	
	public static void main(String[] args) throws IOException, InterruptedException, KeeperException, Exception {
		String id1 = "user1:123456";
		String id2 = "user1:123456";
		String id3 = "user3:123456";
		String idDigested1 = getDigestUserPwd(id1);
		String idDigested2 = getDigestUserPwd(id2);
		String idDigested3 = getDigestUserPwd(id3);
		System.out.println(idDigested1);
		System.out.println(idDigested2);
		System.out.println(idDigested3);
	}
}
